package io.rehuo.modules.app.controller;

import io.rehuo.common.utils.R;
import io.rehuo.modules.app.annotation.Login;
import io.rehuo.modules.app.service.AddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shiguang
 * @date 2022年09月17日 23:48
 */
@RestController
@RequestMapping("/app/address")
@Api("地址管理")
public class AddressController {

    @Autowired
    private AddressService addressService;

    @Login
    @GetMapping(value = "getList")
    @ApiOperation(value = "获取一级地址", notes = "获取一级地址")
    @ApiResponses({
            @ApiResponse(code = 0, message = "操作成功"),
            @ApiResponse(code = 401, message = "权限错误"),
            @ApiResponse(code = 500, message = "系统错误"),
    })
    public R getList(Long parentId) {
        return R.ok().put("list", addressService.getList(parentId));
    }
}
